<?php
function hitPageCounter($mysql,$page,$extra='')
{
	$ip=$_SERVER['REMOTE_ADDR'];
	$host=$mysql->escape_string(@gethostbyaddr($ip));
	$extra=$mysql->escape_string($extra);
	$mysql->query("insert into hitcounter (ip,hostname,page,time,extra) values ('$ip','$host','$page',NOW(),'$extra')");
}
function getPageCounter($myrow)
{
	$query=$mysql->query("select count(*) from hitcounter");
	$row=$query->fetch_array();
	return $row[0];
}
function getPageHits($mysql,$page)
{
	$result=$mysql->query("select count(*) as num from hitcounter where page='$page'");
	$row=$result->fetch_array();
	return $row[0];
}
?>
